//import cn.bdqn.entity.Customer;
//import cn.bdqn.mapper.CustomerMapper;
//import org.apache.ibatis.io.Resources;
//import org.apache.ibatis.session.SqlSession;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.apache.ibatis.session.SqlSessionFactoryBuilder;
//import org.junit.Test;
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.HashMap;
//import java.util.List;
//
///**
// * @Description TODO
// * @Date 2020/2/5 14:40
// * @Created by 张三三
// */
//public class CustomerTest1 {
//
//    @Test
//    public void add_1Test() throws IOException {
//        InputStream is = Resources.getResourceAsStream("configuration.xml");
//        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
//        SqlSession session = factory.openSession(true);
//
//        // SqlSession
//        CustomerMapper mapper = session.getMapper(CustomerMapper.class);
////
//        HashMap<String, Object> map = new HashMap<String, Object>();
//        map.put("aaa","李四");
//        map.put("bbb","山东");
//        int i = mapper.add_1(map);
//        System.out.println("i = " + i);
//
//        session.close();
//    }
//    @Test
//    public void addTest() throws IOException {
//        InputStream is = Resources.getResourceAsStream("configuration.xml");
//        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
//        SqlSession session = factory.openSession(true);
//
//        // SqlSession
//        CustomerMapper mapper = session.getMapper(CustomerMapper.class);
//
//        Customer customer = new Customer();
//        customer.setCname("张三");
//        customer.setCaddress("青岛");
//        int add = mapper.add(customer);
//        System.out.println("add = " + add);
//
//        session.close();
//    }
//
//    @Test
//    public void selectAsCnameTest() throws IOException {
//        InputStream is = Resources.getResourceAsStream("configuration.xml");
//        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
//        SqlSession session = factory.openSession(true);
//
//        // SqlSession
//        CustomerMapper mapper = session.getMapper(CustomerMapper.class);
//        List<Customer> list = mapper.selectAsCname("李");
//        for (Customer customer : list) {
//            System.out.println("customer = " + customer);
//        }
//        session.close();
//    }
//    @Test
//    public void deleteTest() throws IOException {
//        InputStream is = Resources.getResourceAsStream("configuration.xml");
//        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
//        SqlSession session = factory.openSession(true);
//
//        // SqlSession
//        CustomerMapper mapper = session.getMapper(CustomerMapper.class);
//        int i = mapper.deleteById(2);
//        System.out.println("i = " + i);
//
//        session.close();
//    }
//
//
//}
